package com.example.task1.ui.fastfood;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.application.MyApplication;
import com.example.task1.bean.FastFoodDetailBean;
import com.example.task1.bean.FastFoodSearchBean;
import com.example.task1.ui.BaseAdapter;

import java.util.ArrayList;
import java.util.List;

public class FastFoodDetailAdapter extends BaseAdapter<FastFoodDetailBean.DataDTO.StepListDTO> {

    private List<FastFoodDetailBean.DataDTO.StepListDTO> mData = new ArrayList<>();
    private TextView tvContent;
    private ImageView image;

    @Override
    protected void setData(List<FastFoodDetailBean.DataDTO.StepListDTO> rows) {
        mData = rows;
        notifyDataSetChanged();
    }

    @Override
    protected int getLayout() {
        return R.layout.fastfooddetaillist;
    }

    @Override
    protected Context getContext() {
        return null;
    }

    @Override
    protected List<FastFoodDetailBean.DataDTO.StepListDTO> getData() {
        return mData;
    }

    @Override
    protected void onBind(myHolder holder, FastFoodDetailBean.DataDTO.StepListDTO date) {
        MyApplication.glide(image, date.getImgUrl());
        tvContent.setText(date.getContent());
    }

    @Override
    protected void holder(View view) {
        initView(view);
    }

    private void initView(View view) {
        tvContent = view.findViewById(R.id.tv_content);
        image = view.findViewById(R.id.image);
    }
}
